Type.registerNamespace("Telerik.Web.UI.Scheduling");
(function(){var d=$telerik.$;
var e=Telerik.Web.UI;
var h=e.Scheduler.DateTime;
var j=60000;
var f=j*60;
var i=f*24;
var a=2147483647;
var g=new Date("9000/01/01");
var c=10000;
var b="";
Telerik.Web.UI.Scheduling.AdvancedTemplate=function(m,k,l){this._scheduler=$find(m.id);
this._schedulerElement=m;
this._formElement=k;
this._schedulerElementId=this._schedulerElement.id;
this._isModal=l;
this._eventNamespace=m.id;
var n=d("div.rsAdvBasicControls",k);
if(n.length==0){return;
}var o=n[0].id;
this._templateId=o.substring(0,o.lastIndexOf("_"));
};
Telerik.Web.UI.Scheduling.AdvancedTemplate._adjustHeight=function(k){var m=d("div.rsAdvancedEdit:visible",k);
var l=d(".rsAdvContentWrapper",m);
var n=m.outerHeight()-m.height();
n+=l.outerHeight()-l.height();
var p=d("div.rsAdvTitle:visible",k).outerHeight({margin:true});
var q=d("div.rsAdvancedSubmitArea",m);
var o=q.outerHeight({margin:true});
var r=d(k).height()-p-o-n;
d(".rsAdvOptionsScroll",m).height(r+"px");
if(q[0]){q[0].style.cssText=q[0].style.cssText;
}};
Telerik.Web.UI.Scheduling.AdvancedTemplate.prototype={initialize:function(){var l=this._scheduler;
l.add_disposing(Function.createDelegate(this,this.dispose));
d("div.rsAdvancedSubmitArea a",this._formElement).attr("onclick","");
if(l.get_overflowBehavior()==1&&!this._isModal){Telerik.Web.UI.Scheduling.AdvancedTemplate._adjustHeight(this._schedulerElement);
}this._initializePickers();
this._initializeAdvancedFormValidators();
this._initializeAllDayCheckbox();
var m=d("#"+this._templateId+"_RecurrencePanel").length>0;
if(m){this._initializeRecurrenceCheckbox();
this._initializeResetExceptions();
this._initializeRecurrenceRadioButtons();
this._initializeLinkedRecurrenceControls();
}if($telerik.isIE){var k=this._getSubjectTextBox().get_element();
k.style.cssText=k.style.cssText;
}d(".riUp, .riDown",this._formElement).attr("tabindex","-1");
},dispose:function(){if(!this._formElement){return;
}d("*",this._formElement).unbind();
d(document).unbind("."+this._eventNamespace);
this._pickers=null;
this._scheduler=null;
this._schedulerElement=null;
this._formElement=null;
},populate:function(k,p,m){if(!this._clientMode){this._initializeClientMode();
}this._appointment=k;
this._isInsert=p;
this._editSeries=m;
var o=h.getTimeOfDay(k.get_start())==0&&h.getTimeOfDay(k.get_end())==0;
var q=h.getDate(k.get_end());
if(o){q=h.add(q,-i);
}this._getSubjectTextBox().set_value(k.get_subject());
var l=this._getDescriptionTextBox();
if(l){l.set_value(k.get_description());
}this._pickers.startDate.set_selectedDate(h.getDate(k.get_start()));
this._pickers.startTime.set_selectedDate(k.get_start());
this._pickers.endDate.set_selectedDate(q);
this._pickers.endTime.set_selectedDate(k.get_end());
this._populateResources();
this._populateAttributes();
this._initalizeResetExceptionsClientMode();
var n=d("#"+this._templateId+"_AllDayEvent");
if(o!=n[0].checked){n[0].checked=o;
this._onAllDayCheckBoxClick(o,false);
}this._populateRecurrence();
},_initializeClientMode:function(){this._clientMode=true;
var k=this;
d("a.rsAdvEditSave",this._formElement).click(function(l){k._saveClicked();
$telerik.cancelRawEvent(l);
}).attr("href","#");
d("a.rsAdvEditCancel",this._formElement).click(function(l){k._cancelClicked();
$telerik.cancelRawEvent(l);
}).attr("href","#");
},_initalizeResetExceptionsClientMode:function(){var l=d("span.rsAdvResetExceptions > a",this._formElement);
var k=this._appointment.get_recurrenceRule().indexOf("EXDATE")!=-1;
l.unbind();
if(k){var n=this;
var m=this._scheduler.get_localization();
l.attr("href","#").text(m.AdvancedReset).click(function(){n._getRemoveExceptionsDialog().set_onActionConfirm(function(){n._scheduler.removeRecurrenceExceptions(n._appointment);
l.text(m.AdvancedDone);
}).show();
return false;
});
}else{l.text("");
}},_saveClicked:function(){if(typeof(Page_ClientValidate)!="undefined"){var p=this._scheduler._validationGroup+(this._isInsert?"Insert":"Edit");
if(!Page_ClientValidate(p)){return;
}}var n=this._appointment;
if(!this._isInsert){n=this._scheduler.prepareToEdit(n,this._editSeries);
}n.set_subject(this._getSubjectTextBox().get_value());
var o=this._getDescriptionTextBox();
if(o){n.set_description(o.get_value());
}var l=$get(this._templateId+"_AllDayEvent").checked;
var q=this._pickers.startDate.get_selectedDate();
var k=h.getTimeOfDay(this._pickers.startTime.get_selectedDate());
n.set_start(h.add(q,l?0:k));
var m=this._pickers.endDate.get_selectedDate();
var r=h.getTimeOfDay(this._pickers.endTime.get_selectedDate());
n.set_end(h.add(m,l?i:r));
this._saveResources(n);
this._saveAttributes(n);
this._saveRecurrenceRule(n);
if(this._isInsert){this._scheduler.insertAppointment(n);
}else{this._scheduler.updateAppointment(n);
}this._scheduler.hideAdvancedForm();
},_cancelClicked:function(){this._scheduler.hideAdvancedForm();
},_saveResources:function(l){var k=this;
var m=this._scheduler.get_resources();
this._scheduler.get_resourceTypes().forEach(function(q){var r=q.get_name();
var t=k._templateId+"_Res"+r+b;
var s=m.getResourcesByType(r);
if(q.get_allowMultipleValues()){var v=d(String.format("input[id*='{0}']",t),this._formElement);
if(v.length>0){l.get_resources().removeResourcesByType(r);
}for(var n=0;
n<v.length;
n++){if(v[n].checked&&s.get_count()>=n){l.get_resources().add(s.getResource(n));
}}}else{var u=$find(t);
if(!u){return;
}l.get_resources().removeResourcesByType(r);
if(u.get_selectedIndex()==0){return;
}var p=u.get_selectedItem().get_value();
var o=m.findAll(function(w){return w.get_type()==r&&w._getInternalKey()==p;
}).getResource(0)||null;
if(o){l.get_resources().add(o);
}}});
},_saveAttributes:function(l){var k=this;
var m=l.get_attributes();
d.each(this._scheduler.get_customAttributeNames(),function(){var n=this.toString();
var o=$find(k._templateId+"_Attr"+n);
if(!o){return;
}m.removeAttribute(n);
m.setAttribute(n,o.get_value());
});
},_getResourceIndex:function(m){var o=this._scheduler.get_resources().getResourcesByType(m.get_type());
var n,k;
for(n=0,k=o.get_count();
n<k;
n++){var l=o.getResource(n);
if(l.get_type()==m.get_type()&&l.get_key()==m.get_key()){return n;
}}return -1;
},_populateResources:function(){var k=this;
var l=this._scheduler.get_resourceTypes();
l.forEach(function(m){var n=k._templateId+"_Res"+m.get_name()+b;
if(m.get_allowMultipleValues()){d(String.format("input[id*='{0}']",n),this._formElement).each(function(){this.checked=false;
});
}else{var o=$find(n);
if(o){o.get_items().getItem(0).select();
}}});
this._appointment.get_resources().forEach(function(r){var p=k._templateId+"_Res"+r.get_type()+b;
var m=l.getResourceTypeByName(r.get_type());
if(m&&m.get_allowMultipleValues()){var o=k._getResourceIndex(r);
var q=$get(p+"_"+o);
if(q){q.checked=true;
}}else{var n=$get(p);
if(n){k._selectDropDownValue(n,r._getInternalKey());
}}});
},_saveRecurrenceRule:function(k){var l=e.RecurrenceRule.fromPatternAndRange(this._getPattern(),this._getRange(k));
if(!l){k.set_recurrenceRule("");
return;
}var m=e.RecurrenceRule.parse(k.get_recurrenceRule());
if(m){Array.addRange(l.get_exceptions(),m.get_exceptions());
}k.set_recurrenceRule(l.toString());
},_populateAttributes:function(){var k=this;
this._appointment.get_attributes().forEach(function(n,m){var l=$find(k._templateId+"_Attr"+n);
if(!l){return;
}l.set_value(m);
});
},_populateRecurrence:function(){var n=this._appointment.get_recurrenceRule()!="";
this._getRecurrentCheckBox().checked=n;
var p=d("#"+this._templateId+"_RecurrencePanel");
if(!n){if(p.length>0){p.hide();
this._prefillRecurrenceControls();
}return;
}var k=e.RecurrenceRule.parse(this._appointment.get_recurrenceRule());
if(!k){p.hide();
this._getRecurrentCheckBox().checked=false;
return;
}var l=k.get_pattern();
var o=l.get_interval().toString();
var m=l.get_daysOfWeekMask();
switch(l.get_frequency()){case e.RecurrenceFrequency.Hourly:d(this._getElement("RepeatFrequencyHourly")).trigger("click");
this._getControl("HourlyRepeatInterval").set_value(o);
break;
case e.RecurrenceFrequency.Daily:d(this._getElement("RepeatFrequencyDaily")).trigger("click");
if(l.get_daysOfWeekMask()==e.RecurrenceDay.WeekDays){this._getElement("RepeatEveryWeekday").checked=true;
this._getElement("RepeatEveryNthDay").checked=false;
}else{this._getElement("RepeatEveryWeekday").checked=false;
this._getElement("RepeatEveryNthDay").checked=true;
this._getControl("DailyRepeatInterval").set_value(o);
}break;
case e.RecurrenceFrequency.Weekly:d(this._getElement("RepeatFrequencyWeekly")).trigger("click");
this._getControl("WeeklyRepeatInterval").set_value(o);
this._getElement("WeeklyWeekDayMonday").checked=(e.RecurrenceDay.Monday&m)==e.RecurrenceDay.Monday;
this._getElement("WeeklyWeekDayTuesday").checked=(e.RecurrenceDay.Tuesday&m)==e.RecurrenceDay.Tuesday;
this._getElement("WeeklyWeekDayWednesday").checked=(e.RecurrenceDay.Wednesday&m)==e.RecurrenceDay.Wednesday;
this._getElement("WeeklyWeekDayThursday").checked=(e.RecurrenceDay.Thursday&m)==e.RecurrenceDay.Thursday;
this._getElement("WeeklyWeekDayFriday").checked=(e.RecurrenceDay.Friday&m)==e.RecurrenceDay.Friday;
this._getElement("WeeklyWeekDaySaturday").checked=(e.RecurrenceDay.Saturday&m)==e.RecurrenceDay.Saturday;
this._getElement("WeeklyWeekDaySunday").checked=(e.RecurrenceDay.Sunday&m)==e.RecurrenceDay.Sunday;
break;
case e.RecurrenceFrequency.Monthly:d(this._getElement("RepeatFrequencyMonthly")).trigger("click");
if(0<l.get_dayOfMonth()){this._getElement("RepeatEveryNthMonthOnDate").checked=true;
this._getElement("RepeatEveryNthMonthOnGivenDay").checked=false;
this._getControl("MonthlyRepeatDate").set_value(l.get_dayOfMonth());
this._getControl("MonthlyRepeatIntervalForDate").set_value(o);
}else{this._getElement("RepeatEveryNthMonthOnDate").checked=false;
this._getElement("RepeatEveryNthMonthOnGivenDay").checked=true;
this._selectDropDownValue(this._getElement("MonthlyDayOrdinalDropDown"),l.get_dayOrdinal());
this._selectDropDownValue(this._getElement("MonthlyDayMaskDropDown"),m.toString());
this._getControl("MonthlyRepeatIntervalForGivenDay").set_value(o);
}break;
case e.RecurrenceFrequency.Yearly:d(this._getElement("RepeatFrequencyYearly")).trigger("click");
if(0<l.get_dayOfMonth()){this._getElement("RepeatEveryYearOnDate").checked=true;
this._getElement("RepeatEveryYearOnGivenDay").checked=false;
this._getControl("YearlyRepeatDate").set_value(l.get_dayOfMonth());
this._selectDropDownValue(this._getElement("YearlyRepeatMonthForDate"),e.RecurrenceMonth.toString(l.get_month()));
}else{this._getElement("RepeatEveryYearOnDate").checked=false;
this._getElement("RepeatEveryYearOnGivenDay").checked=true;
this._selectDropDownValue(this._getElement("YearlyDayOrdinalDropDown"),l.get_dayOrdinal());
this._selectDropDownValue(this._getElement("YearlyDayMaskDropDown"),m.toString());
this._selectDropDownValue(this._getElement("YearlyRepeatMonthForGivenDay"),e.RecurrenceMonth.toString(l.get_month()));
}break;
}this._populateRecurrenceRange(k.get_range());
p.show();
},_prefillRecurrenceControls:function(){var k=this._appointment.get_start();
var n=k.getDay();
this._getElement("WeeklyWeekDaySunday").checked=n==e.DayOfWeek.Sunday;
this._getElement("WeeklyWeekDayMonday").checked=n==e.DayOfWeek.Monday;
this._getElement("WeeklyWeekDayTuesday").checked=n==e.DayOfWeek.Tuesday;
this._getElement("WeeklyWeekDayWednesday").checked=n==e.DayOfWeek.Wednesday;
this._getElement("WeeklyWeekDayThursday").checked=n==e.DayOfWeek.Thursday;
this._getElement("WeeklyWeekDayFriday").checked=n==e.DayOfWeek.Friday;
this._getElement("WeeklyWeekDaySaturday").checked=n==e.DayOfWeek.Saturday;
var m=k.getDate();
this._getControl("MonthlyRepeatDate").set_value(m);
var l=k.getMonth()+1;
this._selectDropDownValue(this._getElement("YearlyRepeatMonthForDate"),e.RecurrenceMonth.toString(l));
this._getControl("YearlyRepeatDate").set_value(m);
this._selectDropDownValue(this._getElement("YearlyRepeatMonthForGivenDay"),e.RecurrenceMonth.toString(l));
},_populateRecurrenceRange:function(k){var l=k.get_maxOccurrences()!=a;
var n=k.get_recursUntil().getTime()!=g.getTime();
if(!l&&!n){this._getElement("RepeatIndefinitely").checked=true;
this._getElement("RepeatGivenOccurrences").checked=false;
this._getElement("RepeatUntilGivenDate").checked=false;
}else{if(l){this._getElement("RepeatIndefinitely").checked=false;
this._getElement("RepeatGivenOccurrences").checked=true;
this._getElement("RepeatUntilGivenDate").checked=false;
this._getControl("RangeOccurrences").set_value(k.get_maxOccurrences());
}else{this._getElement("RepeatIndefinitely").checked=false;
this._getElement("RepeatGivenOccurrences").checked=false;
this._getElement("RepeatUntilGivenDate").checked=true;
var m=this._scheduler.utcToDisplay(k.get_recursUntil());
if(this._getElement("AllDayEvent").checked){m=h.add(m,-i);
}this._pickers.rangeEndDate.set_selectedDate(m);
}}},_selectDropDownValue:function(m,k){var l=$find(m.id);
if(l&&e.RadComboBox.isInstanceOfType(l)){l.get_items().forEach(function(n){if(n.get_value()==k){n.select();
}});
}else{d.each(m.options,function(){if(this.value==k){this.selected=true;
return false;
}});
}},_getFrequency:function(){if(!this._getRecurrentCheckBox().checked){return e.RecurrenceFrequency.None;
}if(this._getElement("RepeatFrequencyHourly").checked){return e.RecurrenceFrequency.Hourly;
}if(this._getElement("RepeatFrequencyDaily").checked){return e.RecurrenceFrequency.Daily;
}if(this._getElement("RepeatFrequencyWeekly").checked){return e.RecurrenceFrequency.Weekly;
}if(this._getElement("RepeatFrequencyMonthly").checked){return e.RecurrenceFrequency.Monthly;
}if(this._getElement("RepeatFrequencyYearly").checked){return e.RecurrenceFrequency.Yearly;
}return e.RecurrenceFrequency.None;
},_getInterval:function(){switch(this._getFrequency()){case e.RecurrenceFrequency.Hourly:return parseInt(this._getElement("HourlyRepeatInterval").value,10);
case e.RecurrenceFrequency.Daily:if(this._getElement("RepeatEveryNthDay").checked){return parseInt(this._getElement("DailyRepeatInterval").value,10);
}break;
case e.RecurrenceFrequency.Weekly:return parseInt(this._getElement("WeeklyRepeatInterval").value,10);
case e.RecurrenceFrequency.Monthly:if(this._getElement("RepeatEveryNthMonthOnDate").checked){return parseInt(this._getElement("MonthlyRepeatIntervalForDate").value,10);
}else{return parseInt(this._getElement("MonthlyRepeatIntervalForGivenDay").value,10);
}}return 0;
},_getDaysOfWeekMask:function(){switch(this._getFrequency()){case e.RecurrenceFrequency.Daily:return this._getElement("RepeatEveryWeekday").checked?e.RecurrenceDay.WeekDays:e.RecurrenceDay.EveryDay;
case e.RecurrenceFrequency.Weekly:var k=e.RecurrenceDay.None;
k|=this._getElement("WeeklyWeekDayMonday").checked?e.RecurrenceDay.Monday:k;
k|=this._getElement("WeeklyWeekDayTuesday").checked?e.RecurrenceDay.Tuesday:k;
k|=this._getElement("WeeklyWeekDayWednesday").checked?e.RecurrenceDay.Wednesday:k;
k|=this._getElement("WeeklyWeekDayThursday").checked?e.RecurrenceDay.Thursday:k;
k|=this._getElement("WeeklyWeekDayFriday").checked?e.RecurrenceDay.Friday:k;
k|=this._getElement("WeeklyWeekDaySaturday").checked?e.RecurrenceDay.Saturday:k;
k|=this._getElement("WeeklyWeekDaySunday").checked?e.RecurrenceDay.Sunday:k;
return k;
break;
case e.RecurrenceFrequency.Monthly:if(this._getElement("RepeatEveryNthMonthOnGivenDay").checked){return parseInt(this._getControl("MonthlyDayMaskDropDown").get_value(),10);
}break;
case e.RecurrenceFrequency.Yearly:if(this._getElement("RepeatEveryYearOnGivenDay").checked){return parseInt(this._getControl("YearlyDayMaskDropDown").get_value(),10);
}break;
}return e.RecurrenceDay.None;
},_getDayOfMonth:function(){switch(this._getFrequency()){case e.RecurrenceFrequency.Monthly:return this._getElement("RepeatEveryNthMonthOnDate").checked?parseInt(this._getElement("MonthlyRepeatDate").value,10):0;
case e.RecurrenceFrequency.Yearly:return this._getElement("RepeatEveryYearOnDate").checked?parseInt(this._getElement("YearlyRepeatDate").value,10):0;
}return 0;
},_getDayOrdinal:function(){switch(this._getFrequency()){case e.RecurrenceFrequency.Monthly:if(this._getElement("RepeatEveryNthMonthOnGivenDay").checked){return parseInt(this._getControl("MonthlyDayOrdinalDropDown",10).get_value());
}break;
case e.RecurrenceFrequency.Yearly:if(this._getElement("RepeatEveryYearOnGivenDay").checked){return parseInt(this._getControl("YearlyDayOrdinalDropDown",10).get_value());
}break;
}return 0;
},_getMonth:function(){if(this._getFrequency()!=e.RecurrenceFrequency.Yearly){return e.RecurrenceMonth.None;
}var k;
if(this._getElement("RepeatEveryYearOnDate").checked){k=this._getControl("YearlyRepeatMonthForDate").get_value();
}else{k=this._getControl("YearlyRepeatMonthForGivenDay").get_value();
}return e.RecurrenceMonth.parse(k,true);
},_getPattern:function(){if(!this._getRecurrentCheckBox()||!this._getRecurrentCheckBox().checked){return null;
}var k=new e.RecurrencePattern();
k.set_frequency(this._getFrequency());
k.set_interval(this._getInterval());
k.set_daysOfWeekMask(this._getDaysOfWeekMask());
k.set_dayOfMonth(this._getDayOfMonth());
k.set_dayOrdinal(this._getDayOrdinal());
k.set_month(this._getMonth());
if(k.get_frequency()==e.RecurrenceFrequency.Weekly){k.set_firstDayOfWeek(this._scheduler.get_firstDayOfWeek());
}return k;
},_getRange:function(l){if(!this._getRecurrentCheckBox()||!this._getRecurrentCheckBox().checked){return null;
}var o=this._scheduler.displayToUtc(l.get_start());
var m=this._scheduler.displayToUtc(l.get_end());
var k=new e.RecurrenceRange();
k.set_start(o);
k.set_eventDuration(h.subtract(m,o));
k.set_maxOccurrences(0);
k.set_recursUntil(g);
if(this._getElement("RepeatGivenOccurrences").checked){var n=parseInt(this._getElement("RangeOccurrences").value,10);
if(!isNaN(n)){k.set_maxOccurrences(n);
}}if(this._getElement("RepeatUntilGivenDate").checked&&!this._pickers.rangeEndDate.isEmpty()){k.set_recursUntil(this._scheduler.displayToUtc(this._pickers.rangeEndDate.get_selectedDate()));
if(!this._getElement("AllDayEvent").checked){k.set_recursUntil(h.add(k.get_recursUntil(),i));
}}return k;
},_getSubjectTextBox:function(){return $find(this._templateId+"_Subject");
},_getDescriptionTextBox:function(){return $find(this._templateId+"_Description");
},_getElement:function(k){return $get(this._templateId+"_"+k);
},_getControl:function(k){return $find(this._templateId+"_"+k);
},_getRecurrentCheckBox:function(){return this._getElement("RecurrentAppointment");
},_initializePickers:function(){var l=Function.createDelegate(this,this._showPopup);
var m=this._templateId;
this._pickers={startDate:$find(m+"_StartDate"),endDate:$find(m+"_EndDate"),rangeEndDate:$find(m+"_RangeEndDate"),startTime:$find(m+"_StartTime"),endTime:$find(m+"_EndTime")};
d.each(this._pickers,function(){if(this&&this.get_dateInput){this.get_dateInput().add_focus(l);
}});
var k=[$get(this._pickers.startDate.get_element().id+"_wrapper"),$get(this._pickers.startTime.get_element().id+"_wrapper"),$get(this._pickers.startTime.get_element().id+"_timeView_wrapper"),$get(this._pickers.endDate.get_element().id+"_wrapper"),$get(this._pickers.endTime.get_element().id+"_wrapper"),$get(this._pickers.endTime.get_element().id+"_timeView_wrapper"),$get(this._templateId+"_SharedCalendar")];
if(this._pickers.rangeEndDate){Array.add(k,$get(this._pickers.rangeEndDate.get_element().id+"_wrapper"));
}var o=this;
var n="focusin";
d(this._formElement).bind(n,function(t){var r=false;
for(var s=0,p=k.length;
s<p;
s++){var q=k[s];
if($telerik.isDescendantOrSelf(q,t.target)){r=true;
break;
}}if(!r){o._hidePickerPopups();
}});
d(this._formElement).bind("formMoving",function(){o._hidePickerPopups();
});
if(this._isModal){d(document).bind("scroll."+this._eventNamespace,function(){o._hidePickerPopups();
});
}},_initializeAdvancedFormValidators:function(){var n=this._createValidatorToolTip();
if(typeof(Page_Validators)=="undefined"){return;
}for(var l=0;
l<Page_Validators.length;
l++){var o=Page_Validators[l];
if(this._validatorIsInTemplate(o)){var m=d("#"+o.controltovalidate);
if(m.length==0){break;
}if(m.parent().is(".rsAdvDatePicker")||m.parent().is(".rsAdvTimePicker")){d("#"+o.controltovalidate+"_dateInput_text").bind("focus",{toolTip:n},this._showToolTip).bind("blur",{toolTip:n},this._hideToolTip)[0].errorMessage=o.errormessage;
}else{m.addClass("rsValidatedInput");
}m[0].errorMessage=o.errormessage;
this._updateValidator(o,m);
}}var p=this;
var k=ValidatorUpdateDisplay;
ValidatorUpdateDisplay=function(q){if(p._validatorIsInTemplate(q)&&q.controltovalidate){p._updateValidator(q);
}else{k(q);
}};
d(".rsValidatedInput",this._formElement).bind("focus",{toolTip:n},this._showToolTip).bind("blur",{toolTip:n},this._hideToolTip);
},_initializeAllDayCheckbox:function(){var l=d("#"+this._templateId+"_AllDayEvent");
var m=d(l[0].parentNode.parentNode.parentNode);
var r=m.find(".rsAdvTimePicker");
if($telerik.isIE6||$telerik.isIE7){d(".rsAdvTimePicker, .rsAdvDatePicker",this._formElement).css({display:"inline",zoom:1,width:""});
}else{d(".rsAdvTimePicker, .rsAdvDatePicker",this._formElement).css({display:"inline-block",width:""});
}var o=d("#"+this._templateId+"_StartTime_dateInput_text").outerWidth();
r.width(o);
var t=d(".rsTimePick",this._formElement).eq(0).outerWidth();
var p=t-o;
var q=$get(this._templateId+"_StartTimeValidator");
var s=$get(this._templateId+"_StartTimeValidator");
var k=this;
m.find(".rsAdvTimePicker > input").css("display","none");
var n=function(x,v){var w=function(){if($telerik.isSafari||$telerik.isOpera){r.css("display","inline-block");
}else{r.show();
}};
if(!x){w();
}m.find(".rsTimePick").each(function(){if(v){d(this).stop();
if(x){d(this).animate({width:p},"fast","linear",function(){r.hide();
});
}else{d(this).animate({width:t},"fast");
}}else{if(x){r.hide();
d(this).width(p);
}else{d(this).width(t);
}}});
if(typeof(ValidatorEnable)!="undefined"){ValidatorEnable(q,!x);
ValidatorEnable(s,!x);
}var y=k._pickers.startTime;
y.set_enabled(!x);
var u=k._pickers.endTime;
u.set_enabled(!x);
};
this._onAllDayCheckBoxClick=n;
n(l[0].checked,false);
l.click(function(){n(this.checked,true);
});
},_initializeRecurrenceCheckbox:function(){var l=d("#"+this._templateId+"_RecurrencePanel");
var k=d("#"+this._templateId+"_RecurrentAppointment");
if(k[0].checked){l.show();
}k.click(function(){l.stop(false,true).animate({height:"toggle"},"slow");
});
},_initializeResetExceptions:function(){var l=d("#"+this._templateId+"_ResetExceptions");
if(l.length==0){return;
}var m=this._scheduler;
var k=this;
var o=m.get_localization();
var n=o.AdvancedDone;
if(l[0].innerHTML.indexOf(n)>-1){l.click(function(){return false;
});
window.setTimeout(function(){l.fadeOut("slow");
},2000);
}else{l.click(function(){var p=k._getRemoveExceptionsDialog();
p.set_onActionConfirm(function(){l[0].innerHTML=o.AdvancedWorking;
window.location.href=l[0].href;
p.dispose();
}).show();
return false;
});
}},_getRemoveExceptionsDialog:function(){var k=this._scheduler.get_localization();
return $telerik.$.modal(this._formElement).initialize().set_content({title:k.ConfirmResetExceptionsTitle,content:k.ConfirmResetExceptionsText,ok:k.ConfirmOK,cancel:k.ConfirmCancel});
},_initializeRecurrenceRadioButtons:function(){var m=[$get(this._templateId+"_RepeatFrequencyHourly"),$get(this._templateId+"_RepeatFrequencyDaily"),$get(this._templateId+"_RepeatFrequencyWeekly"),$get(this._templateId+"_RepeatFrequencyMonthly"),$get(this._templateId+"_RepeatFrequencyYearly")];
var o=d("#"+this._templateId+"_RecurrencePatternPanel .rsAdvPatternPanel");
var l=function(r){var q=r.value.replace("RepeatFrequency","RecurrencePattern")+"Panel";
return o.filter("[id$='"+q+"']");
};
for(var n=0,k=m.length;
n<k;
n++){var p=m[n];
if(p.checked){l(p).show();
}d(p).click(function(){var q=d(l(this));
if(q.css("display")=="none"){o.hide();
q.show();
}});
}},_initializeLinkedRecurrenceControls:function(){var m={};
var k=this._templateId;
var l="#"+k;
m[k+"_RepeatEveryNthDay"]=[d(l+"_DailyRepeatInterval"),d(l+"_DailyRepeatInterval_SpinUpButton"),d(l+"_DailyRepeatInterval_SpinDownButton")];
m[k+"_RepeatEveryNthMonthOnDate"]=[d(l+"_MonthlyRepeatDate"),d(l+"_MonthlyRepeatDate_SpinUpButton"),d(l+"_MonthlyRepeatDate_SpinDownButton"),d(l+"_MonthlyRepeatIntervalForDate"),d(l+"_MonthlyRepeatIntervalForDate_SpinUpButton"),d(l+"_MonthlyRepeatIntervalForDate_SpinDownButton")];
m[k+"_RepeatEveryNthMonthOnGivenDay"]=[d(l+"_MonthlyDayOrdinalDropDown"),d(l+"_MonthlyDayMaskDropDown"),d(l+"_MonthlyRepeatIntervalForGivenDay"),d(l+"_MonthlyRepeatIntervalForGivenDay_SpinUpButton"),d(l+"_MonthlyRepeatIntervalForGivenDay_SpinDownButton")];
m[k+"_RepeatEveryYearOnDate"]=[d(l+"_YearlyRepeatMonthForDate"),d(l+"_YearlyRepeatDate"),d(l+"_YearlyRepeatDate_SpinUpButton"),d(l+"_YearlyRepeatDate_SpinDownButton")];
m[k+"_RepeatEveryYearOnGivenDay"]=[d(l+"_YearlyDayOrdinalDropDown"),d(l+"_YearlyDayMaskDropDown"),d(l+"_YearlyRepeatMonthForGivenDay")];
m[k+"_RepeatGivenOccurrences"]=[d(l+"_RangeOccurrences"),d(l+"_RangeOccurrences_SpinUpButton"),d(l+"_RangeOccurrences_SpinDownButton")];
m[k+"_RepeatUntilGivenDate"]=[d(l+"_RangeEndDate_dateInput_text")];
d.each(m,function(n){var p=d("#"+n);
var o=m[n][0];
p.click(function(){if(o.css("visibility")=="hidden"){var q=d("#"+o[0].id+"_text");
if(q){q.focus();
}}else{o.focus();
}});
d.each(m[n],function(){d(this).focus(function(){p[0].checked=true;
});
});
});
},_updateValidator:function(l){var k=d("#"+l.controltovalidate);
if(k.is(".rsValidatedInput")){k=k.parent();
}if(!l.isvalid){k.addClass("rsInvalid");
}else{k.removeClass("rsInvalid");
}},_validatorIsInTemplate:function(k){return d(k).parents().is("#"+this._schedulerElementId);
},_createValidatorToolTip:function(){return d("<div></div>").hide().appendTo("#"+this._schedulerElementId);
},_showToolTip:function(o){var k=o.data.toolTip;
var m=d(this);
var s=false;
var n=m.parent();
if(m.is("textarea")){s=true;
m=n;
}var r=m.is(".rsInvalid");
r=r||n.parent().children().is(".rsInvalid");
if(r){k.css("visibility","hidden").text(this.errorMessage).addClass("rsValidatorTooltip");
var l=m;
if(n.is(".riCell")){l=n;
}var p=l.offset();
var t=p.left+"px";
if(s){t=(p.left+l.outerWidth()-k.outerWidth())+"px";
}var q=(p.top-k.outerHeight())+"px";
k.css({top:q,left:t,zIndex:c,visibility:"visible"}).fadeIn("fast");
}},_hideToolTip:function(l){var k=l.data.toolTip;
k.hide();
},_hidePickerPopups:function(){if(!this._pickers){return;
}for(var l in this._pickers){var k=this._pickers[l];
if(!k){continue;
}if(k.hideTimePopup){k.hideTimePopup();
}else{k.hidePopup();
}}},_showPopup:function(k){this._hidePickerPopups();
if(k.Owner.showTimePopup){k.Owner.showTimePopup();
}else{k.Owner.showPopup();
}}};
})();
